#include <time.h>
#include <nxos.h>

/* There is no other implemented value than TIME_UTC; all other values
 * are considered erroneous. */
int timespec_get(struct timespec * ts, int base)
{
    time_t tm;
	if (base != TIME_UTC) return 0;

    tm = time(&tm);
    
    if (ts) {
        ts->tv_sec = tm;
        ts->tv_nsec = NX_ClockGetMillisecond() * 1000UL;
    }
	return base;
}
